//
//  QYXFindMoreAuthor.m
//  OpenYourEyes
//
//  Created by dllo on 16/6/6.
//  Copyright © 2016年 Google AdWords. All rights reserved.
//

#import "QYXFindMoreAuthor.h"
#import "UIImageView+QYXCarveImage.h"

@interface QYXFindMoreAuthor ()

/** 头像 */
@property (nonatomic, strong) UIImageView *pic;


/** 标题 */
@property (nonatomic, strong) UILabel *tilteLabel;


@end

@implementation QYXFindMoreAuthor



- (instancetype)initWithFrame:(CGRect)frame WithPicUrl:(NSString *)picUrl WithTitle:(NSString *)title;
{
    self = [super initWithFrame:frame];
    if (self) {
        
             
        self.pic  = [[UIImageView alloc] init];
        [self addSubview:self.pic];
        [UIImageView CareImageWithUIImageView:_pic];
        
        [self.pic makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.leading).offset(15);
            make.trailing.equalTo(self.trailing).offset(-15);
            make.top.equalTo(self.top).offset(10);
            make.height.equalTo(self.bounds.size.width - 30);
            
        }];
        
        [self.pic sd_setImageWithURL:[NSURL URLWithString:picUrl] placeholderImage:kPlaceHolderImage];
        self.pic.layer.cornerRadius = (self.bounds.size.width - 30) * 0.5;
        self.pic.layer.masksToBounds = YES;
        
        self.tilteLabel = [[UILabel alloc] init];
        [self addSubview:_tilteLabel];
        
        [self.tilteLabel makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.pic.leading);
            make.trailing.equalTo(self.pic.trailing);
            make.top.equalTo(self.pic.bottom).offset(5);
            make.bottom.equalTo(self.bottom).offset(-5);
        }];
        
        self.tilteLabel.text = title;
        self.tilteLabel.textAlignment = NSTextAlignmentCenter;
        self.tilteLabel.font = [UIFont systemFontOfSize:14];
        self.tilteLabel.textColor = [UIColor grayColor];
        
        
    }
    return self;
}


@end
